#include <iostream>
#include <cstdio>
#include <vector> 
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <utility> 
#include <unistd.h>

using namespace std; 
unsigned lvl; 

#define O(a) ", " #a "="<<a

void qsort_partition(vector<int> &items, int &left, int &right)
{
	int lo=left, hi=right; 
	int x = items[(lo+hi)/2]; 

	do {
		while(items[lo]<x) 
			lo++; 
		while(items[hi]>x) 
			hi--; 
		if (lo<=hi) {
			swap(items[lo], items[hi]); 
			lo++; 
			hi--; 
		}
	} while(lo<=hi); 
	left = lo;
	right = hi; 
	//<<"lvl="<<lvl<<", start="<<start<<", n="<<n<<", k="<<k<<", x="<<x<<", ret="<<j<<"\n"; 
}

void qsort_loop(vector<int> &items)
{
	vector < pair<int,int> > stack; 
	int left, right; 
	pair<int,int> p; 
	
	if (items.size()<2)
		return; 
	p = make_pair(0, items.size()-1); 
	stack.push_back(p); 
	while(stack.size()!=0) {
		p = stack.back(); 
		//cout<<O(__LINE__)<<O(p.first)<<O(p.second)<<"\n"; 
		stack.pop_back(); 
		left = p.first; 
		right = p.second; 
		qsort_partition(items, left, right); 
		if (right>p.first) {
			//cout<<O(__LINE__)<<"\n"; 
			stack.push_back(make_pair(p.first, right)); 
		} 
		if (p.second>left) {
			//cout<<O(__LINE__)<<"\n"; 
			stack.push_back(make_pair(left, p.second)); 
		}
		//cout<<O(stack.size())<<O(p.first)<<O(p.second)<<O(left)<<O(right)<<"\n";  
	}
}


int main()
{
	vector<int> a; 
	int i, n, t; 

	srand(time(NULL)); 

	//freopen("p1177_5.in", "r", stdin); 

	cin>>n; 
	for(i=0; i<n; i++) {
		cin>>t; 
		a.push_back(t); 
	}
	qsort_loop(a); 
	
	for (i=0; i<a.size(); i++) {
		cout<<a[i]<<" "; 
	}
	cout<<"\n"; 

	return 0; 
}

